﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace EfeitosEspeciais03
{
    
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        Texture2D imagem;
        Vector2 posicaoXY;
        Point mouseXY;
        int persianaEfeito = 1;
        bool persianaEfeitoOn = false;
        float angulo = 0; // ← declaramos uma variável para o angulo


        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

      
        protected override void Initialize()
        {
            IsMouseVisible = true;

            base.Initialize();
        }


        protected override void LoadContent()
        {
            
            spriteBatch = new SpriteBatch(GraphicsDevice);

            imagem  = Content.Load<Texture2D>("logoXNA");
        }

        protected override void UnloadContent()
        {
            
        }


        protected override void Update(GameTime gameTime)
        {
          

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();

            float desloc = 0;
            angulo = (int)(gameTime.TotalGameTime.TotalSeconds * 15) % 360;

            for (int i = 0; i < imagem.Height; i++)
            {
                spriteBatch.Draw(imagem, new Rectangle((int)posicaoXY.X + (int)desloc,
                    (int)posicaoXY.Y + i, imagem.Width, 1), 
                    new Rectangle(0, i, imagem.Width, 1), Color.White);
                
                desloc = (float)Math.Cos(i - angulo) * 5;
            }         
            
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}
